A principal advantage of a WINDOWS based operating system is its capability to enable a plurality of application programs to multitask or run simultaneously. However, only one of these programs owns the input focus at a time. The user determines which application has the input focus (the "active application"), and receives the user's keystrokes and mouse clicks. Applications which are running but do not have the input focus, are termed "inactive". Inactive applications are often "minimized" by a user, which action causes any visible windows belonging to the application to be hidden and the application to represented by a small picture (icon) or text representation, typically located in the bottom portion of the display, indicating that the application is running, but is not active. Frequently, a single active application is used by the user for an extended period of time, and the user does not switch to other running, inactive applications very often.
Applications that are running, but inactive continue to receive processor time and often continue to consume substantial quantities of system memory, including memory occupied by program code and data. Therefore, the existence of one or more running, inactive applications increases the load on the system resources (e.g., memory consumption and CPU usage), thus hampering the overall performance of the computer system.
An application may readily detect when it has been made inactive, and it has the ability to reduce its contribution to overall system load in a number of ways, including: causing at least a portion of its memory to be discarded or deallocated; marking its pageable data segments as candidates to be paged out by the virtual memory manager; releasing desktop or display resources that are not necessary while it is inactive; and reducing its processor usage by disabling timers, ceasing background execution, etc. However, application programs often do not take any of these steps to reduce consumption of system resources. One reason for this is that releasing system resources may increase the time needed to reactivate the application. Additionally, the steps that may be taken to reduce an application's system load are dependent on the programmers who designed the application, are therefore specific to that application, and do not usually apply to other application programs that may be contributing to the system load. Furthermore, the effort expended on reducing overhead may be wasted if the user intends to re-activate the application almost immediately.
An application's 16 or 32 bit program code and resource segments consume a significant portion of the system resources utilized by the application. Many such segments are provided with an attribute specifying that the segment is "discardable", in its entirety, at the discretion of the WINDOWS Kernel or at the request of the application program. When a segment is discarded, the memory that has been allocated to the segment is released to the operating system as free memory. Such segments contain readonly program code or resources, so the Kernel is able to reload or reconstitute the segment from its disk image contained in the programs's executable file, when it is needed. For 16 bit programs, these discardable segments are allocated from the WINDOWS Global Heap memory. For Win32 programs (32 bit programs), discardable segments are assigned to linear memory backed by a memory file mapping. The memory associated with these discardable segments in Win32 programs is available to be released by the WINDOWS memory manager to reduce overall consumption of system memory resources.
As for 16 bit programs, the Kernel only resorts to discarding when available linear memory is exhausted, which is an infrequent occurrence, because linear memory is generally abundant. Moreover, the Kernel discards discardable segments indiscriminately, whereby segments belonging to the active application are as likely to be discarded as those belonging to inactive applications. Additionally, because free physical memory is typically exhausted long before this compaction occurs, some portions of the application, including its discardable data, are likely to have been paged out to the virtual memory swap file. Because substantial portions of inactive applications may be accessed on a regular or frequent basis due to message handling of system messages and broadcasts, these portions are not likely to be paged out. Note that this is also applicable for 32 bit applications.
One prior art attempt to conserve system resources utilized by inactive programs is the program known as WinProbe, which is commercially available from QUARTERDECK. WinProbe is a system monitor program that presents to the user the status of various components of the operating system. Additionally, it provides a "memory optimizer", which causes the WINDOWS Global Heap to be "optimized" on an immediate basis, or at a settable interval for as long as WinProbe remains loaded. In order to optimize the heap, WinProbe issues a GlobalCompact call to the Kernel causing all discardable segments in the Global Heap to be discarded. But this approach has the drawback of requiring the user to execute a separate program in order to perform the compaction operation. It has a further drawback of causing all loaded segments to be discarded indiscriminately. Additionally, a percentage of these segments will have to be reloaded by the Kernel immediately as they are accessed by running programs. Yet a further drawback is that WinProbe has no effect on memory containing data or memory assigned to 32 bit processes.
Therefore, it is an object of the invention to conserve system resources consumed by running, inactive programs, while overcoming the drawbacks of prior art methods of doing so.